import request from '@/plugin/axios'
import util from '@/libs/util.js'
// const getBuildingList =   function getBuildingList(data) {
//     data.UserId = util.cookies.get('uuid');
//     return request({
//         url: '/building/List',
//         method: 'post',
//         data
//     })
// };
const submitBuilding =   function submitBuilding(data) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/building/Add',
        method: 'post',
        data
    })
};
const  getBuildingList = (data)=>request({
    url: '/building/List',
    method: 'post',
    data
});
const getInspectItemsList=   function getInspectItemsList(data) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/InspectItems/List',
        method: 'post',
        data
    })
};
const submitInspectItems =   function submitInspectItems(data) {

    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/InspectItems/Add',
        method: 'post',
        data
    })
};
export function getPatrolTable(data) {
    //var data = {};
    data.UserId = util.cookies.get('uuid');
    //data.buildingId=util.cookies.get('uuid1');
    return request({
        url: '/inspectplace/List',
        method: 'post',
        data
    })
}
const  deletePatrol =   function  deletePatrol(data) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/inspectplace/Delete',
        method: 'post',
        data
    })
};
const submitInspectplace =   function submitInspectplace(data) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/inspectplace/Add',
        method: 'post',
        data
    })
};
const deleteBuilding =   function deleteCollector(data) {

    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/building/Delete',
        method: 'post',
        data
    })
};

//获取搜索关键词列表
const getInspectItems=   function getInspectItems(data) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/InspectItems/List',
        method: 'post',
        data
    })
};
//获取表格巡查项
const getListItems =   function getListItems(data) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/inspectplace/ListItems',
        method: 'post',
        data
    })
};

//获取巡查分类
const getInspectTypeListItems =   function getInspectTypeListItems(data = {}) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/inspecttypes/List',
        method: 'post',
        data
    })
};

//获取巡查分组
const getInspectGroupListItems =   function getInspectGroupListItems(data = {}) {
    data.UserId = util.cookies.get('uuid');
    return request({
        url: '/inspectgroups/List',
        method: 'post',
        data
    })
};

const deleteInspectItems = function deleteInspectItems(data,Id) {
    data.UserId = util.cookies.get('uuid');
    data.Id = Id
    return request({
        url: '/InspectItems/Delete',
        method: 'post',
        data
    })
}
//为巡查点添加巡查项
const addInspectItems = function addInspectItems(inspectItemsIds,placeId) {
    var data = {}
    data.UserId = util.cookies.get('uuid');
    data.items = inspectItemsIds
    data.placeId = placeId
    return request({
        url: '/inspectplace/AddItems',
        method: 'post',
        data
    })
}
export {
    addInspectItems,
    deleteInspectItems,
    getInspectTypeListItems,
    getInspectGroupListItems,
    getBuildingList,
    submitBuilding,
    getInspectItemsList,
    submitInspectItems,
    deletePatrol,
    submitInspectplace,
    deleteBuilding,
    getInspectItems,
    getListItems
}
